package com.fjrz.bbxwj.mode.api

import com.fjrz.bbxwj.entity.FeedbackTypeResponse
import com.module.lemlin.mode.SubscribeListener
import com.module.lemlin.rxhttp.HttpServiceData
import com.module.lemlin.rxhttp.subscribe
import io.reactivex.rxjava3.disposables.Disposable
import rxhttp.RxHttp


/**
 * 反馈类型
 * */
fun feedbackTypeList(
    listener: SubscribeListener<FeedbackTypeResponse>
): Disposable = subscribe(
    RxHttp.get("/api/feedback/type_list")
        .asClass(FeedbackTypeResponse::class.java)
    , listener
)

/**
 * 提交反馈
 *
 * @param typeId 类型ID
 * @param content 内容
 * */
fun feedbackSubmit(
    typeId: String, content: String, listener: SubscribeListener<HttpServiceData>
): Disposable = subscribe(
    RxHttp.postForm("/api/feedback/submit")
        .add("type", typeId)
        .add("content", content)
        .asClass(HttpServiceData::class.java)
    , listener
)